package Terminal.View;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

import Terminal.Controller.CSession;
//import Server.View.Intestazione;

public class TimeLoggingFrame extends JFrame{

	private static final long serialVersionUID = 5875400095285549752L;
	private TimeLoggingPanel pannello;
	private static TimeLoggingFrame _istanza;

	public static TimeLoggingFrame istanza()
	{
		if (_istanza == null)
			_istanza = new TimeLoggingFrame();
		return _istanza;
	}


	private TimeLoggingFrame(){
		super("TimeLogging - Terminale Consulente");	
		
		pannello = new TimeLoggingPanel();
		
		setExtendedState(JFrame.MAXIMIZED_BOTH);
		
		setLayout(null);
		setSize(1366,725);

		add(pannello);//, BorderLayout.CENTER);
		
		setVisible(true);
		
		addWindowListener( new WindowAdapter() 
		{
			public void windowClosing(WindowEvent e) 
			{
				System.exit(0);
			}
		});
		
	}
	
	public void refresh(){
		System.out.print("\n"+getContentPane());
		getContentPane().removeAll();
		CSession session = CSession.instanza();			
		JPanel pannello = session.getGestoreInterfaccia().createInterfaccia();
		/*setSize(1366,725);
		setLayout(null);*/
		getContentPane().add(pannello);
		validate();
		repaint();

	}
	
	public TimeLoggingPanel getPannello()
	{
		return this.pannello;
	}
	
	

}
